import request from '@/utils/request'
/**
 *  获取权限列表
 */
export function getPermission() {
  return request({
    url: '/sys/permission'
  })
}

// 删除权限
export function delPermission(id) {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}

/**
 * 添加权限  /sys/permission
 */
export function addPermission(data) {
  return request({
    url: `/sys/permission`,
    method: 'post',
    data
  })
}
/**
 * 更新权限 /sys/permission/{id}
 */
export function updatePermission(data) {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}

/**
 *   获取 用户权限点数据  getpermIds
 */
export function getpermIds(id) {
  return request({
    url: `/sys/role/${id}`
  })
}
// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
